<template>
    <div class="message">
      <template v-if="person_message && person_message.vipLevel == 0">
        <div class="bg01">
          <p>{{ person_message.nickName }}</p>
          <!-- 啦啦啦啦 -->
          <div class="novip">
            <p>
              <!-- <span>当前版本：</span> -->
              <span>免费版用户</span>
            </p>
            <button @click="$router.push('/talent_main/buy')">开通会员</button>
          </div>
        </div>
        <ul>
          <li @click="$router.push('/talent_main/person_center')">
            <img src="@/assets/meng/c2.png" class="img01" />
            <span>个人中心</span>
          </li>
          <li @click="$router.push('/talent_main/buy')">
            <img src="@/assets/meng/c3.png" class="img02" />
            <span>开通会员</span>
          </li>
          <li @click="$router.push('/talent_main/sendMembers')">
            <img src="@/assets/meng/cc.png" class="img02" />
            <span>邀好友送会员</span>
          </li>
          <li @click="exit()">
            <img src="@/assets/meng/c4.png" class="img03" />
            <span>退出登录</span>
          </li>
        </ul>
      </template>
      <template v-if="person_message && person_message.vipLevel != 0">
        <div class="bg02">
          <p>{{ person_message.nickName }}</p>
          <div class="vipbox">
            <div>
              <p>
                <span v-if="person_message.vipLevel == 1">SVIP-企业版</span>
                <span v-if="person_message.vipLevel == 2">Plus-企业版</span>
                <span v-if="person_message.vipLevel == 3">体验版</span>
                <span v-if="person_message.vipLevel == 4">VIP-企业版</span>
                <span v-if="person_message.vipLevel == 5">SVIP-个人版</span>
              </p>
              <div v-if="person_message.autoVipType != 0 && person_message.vipLevel == 5">
                <p>(连续包{{person_message.duration == '12' ? '年' : person_message.duration == '3' ? '季' : '月'}})</p>
              </div>
              <div v-else>
                <p>{{ person_message.vipEndTime1 }}</p>
                会员到期
              </div>
            </div>
            <button @click="$router.push('/talent_main/buy')">
              {{
                person_message.vipLevel == "0" || person_message.vipLevel == "3"
                  ? "升级会员"
                  : "续费会员"
              }}
            </button>
          </div>
        </div>
        <ul>
          <li @click="$router.push('/talent_main/person_center')">
            <img src="@/assets/meng/c2.png" class="img01" />
            <span>个人中心</span>
          </li>
          <li @click="$router.push('/talent_main/buy')">
            <img src="@/assets/meng/c3.png" class="img02" />
            <span>购买续费</span>
          </li>
          <li @click="$router.push('/talent_main/sendMembers')">
            <img src="@/assets/meng/cc.png" class="img02" />
            <span>邀好友送会员</span>
          </li>
          <li @click="exit()">
            <img src="@/assets/meng/c4.png" class="img03" />
            <span>退出登录</span>
          </li>
        </ul>
      </template>
    </div>
</template>

<script>
export default {
  props: ["person_message"],
  data() {
    return {};
  },
  created() {
    // console.log(this.person_message);
  },
  methods: {
    exit() {
      this.$router.push("/");
      this.$clearLocal();
      this.$emit("logOut",false,)
      this.$message({
        message: "退出登录成功！",
        type: "success",
        duration: 2000,
      });
    },
  },
};
</script>

<style scoped lang="less">
.message {
  z-index: 99;
  overflow: hidden;
  .bg01 {
    background-image: url("~@/assets/meng/novip.png");
    .novip {
      background: #414558;
      width: 244px;
      height: 60px;
      border-top-left-radius: 4px;
      border-top-right-radius: 4px;
      padding: 20px 15px 0 15px;
      box-sizing: border-box;
      display: flex;
      justify-content: space-between;
      span {
        color: #fff !important;
        font-size: 13px;
        padding-top: 20px;
      }
      > button {
        width: 72px;
        height: 28px;
        line-height: 28px;
        border-radius: 20px;
        background: #fee0c8;
        color: #222;
        margin-top: -4px;
      }
    }
  }
  .bg02 {
    // position: absolute;
    // top: 81px;
    // right: 0px;
    width: 284px;
    background-color: #ffffff;
    box-shadow: 0px 0px 20px 0px rgba(181, 181, 181, 0.3);
    border-radius: 6px;
    box-sizing: border-box;
    display: none;
    background-image: url("~@/assets/meng/vip.png");
    .vipbox {
      width: 244px;
      height: 60px;
      overflow: hidden;
      background: #414659;
      border-top-left-radius: 4px;
      border-top-right-radius: 4px;
      display: flex;
      justify-content: space-between;
      padding: 0 15px;
      box-sizing: border-box;
      > div {
        > p {
          padding-top: 14px;
          span {
            font-size: 14px;
            color: #fff !important;
          }
        }
        > div {
          font-size: 12px;
          color: #b3b4bc;
          display: flex;
          > p {
            width: 66px;
            overflow: hidden;
            height: 14px;
          }
        }
      }
      button {
        width: 72px;
        height: 28px;
        line-height: 26px;
        border-radius: 20px;
        background-image: linear-gradient(#feeee0, #fdcda5);
        color: #222;
        margin-top: 16px;
      }
    }
  }
  > div:first-child {
    width: 284px;
    // height: 100px;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    padding-left: 20px;
    padding-top: 26px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    > p:first-child {
      font-size: 18px;
      color: #222;
      padding-bottom: 18px;
    }
    > p:last-child {
      > span:nth-child(1) {
        font-size: 12px;
        color: #8e9298;
        line-height: 28px;
      }
      > span:nth-child(2) {
        font-size: 12px;
        line-height: 28px;
        color: #434951;
      }
      //   > button:nth-child(3) {
      //     width: 72px;
      //     height: 28px;
      //     border-radius: 4px;
      //     border: solid 1px #555555;
      //     text-align: center;
      //     font-size: 12px;
      //     color: #555555;
      //     line-height: 24px;
      //     background-color: transparent;
      //     float: right;
      //   }
    }
    
  }
  ul {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    li:nth-of-type(1) {
      padding-top: 24px;
    }
    li:last-of-type {
      padding-top: 20px;
      padding-bottom: 20px;
      border-top: 1px solid #e5e5e5;
    }
    li {
      cursor: pointer;
      width: 100%;
      padding: 12px 0;
      padding-left: 18px;
      box-sizing: border-box;
      display: flex;
      align-items: center;
      font-size: 14px;
      color: #222222;
      img {
        margin-right: 15px;
      }
      .img01 {
        width: 16px;
        height: 16px;
        border-radius: 0;
        border: none;
      }
      .img02 {
        width: 16px;
        height: 14px;
        border-radius: 0;
        border: none;
      }
      .img03 {
        width: 16px;
        height: 15px;
        border-radius: 0;
        border: none;
      }
    }
    li:hover {
      background: #f5f7fa;
    }
  }
  img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid #e6e6e6;
    cursor: pointer;
  }
}
</style>
